﻿Imports System.Windows.Forms

Public Class iWatchSettings

    Public TakenSourceNames() As String = New String() {}



    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
        If SourceName.Text = "" Then
            MessageBox.Show("Source name is blank." + vbCr + "Please enter a unique source name")
            Exit Sub
        End If
        For Each TakenSourceName In TakenSourceNames
            If TakenSourceName = SourceName.Text Then
                MessageBox.Show("Source name is already in use." + vbCr + "Please enter a unique source name")
                Exit Sub
            End If
        Next

        Me.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.Close()
    End Sub

    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub


    Private Sub WatchBrowsePath_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WatchBrowsePath.Click
        Dim FBD As New FolderBrowserDialog
        FBD.ShowNewFolderButton = True
        If FBD.ShowDialog() = Windows.Forms.DialogResult.OK Then
            WatchPath.Text = FBD.SelectedPath
        End If


    End Sub

    Private Sub DestinationBrowsePath_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DestinationBrowsePath.Click
        Dim FBD As New FolderBrowserDialog
        FBD.ShowNewFolderButton = True
        If FBD.ShowDialog() = Windows.Forms.DialogResult.OK Then
            DestinationPath.Text = FBD.SelectedPath
        End If

    End Sub

    Private Sub FFMPEGTempFolderBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FFMPEGTempFolderBrowse.Click
        Dim FBD As New FolderBrowserDialog
        FBD.ShowNewFolderButton = True
        If FBD.ShowDialog() = Windows.Forms.DialogResult.OK Then
            FFMPEGTempFolder.Text = FBD.SelectedPath
        End If
    End Sub
End Class
